package com.atguigu.redislock.test;

import cn.hutool.core.util.IdUtil;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.Optional;
import java.util.Timer;
import java.util.TimerTask;

/**
 * @auther zzyy
 * @create 2022-10-22 23:47
 */
public class T1
{
    public static void main(String[] args)
    {
        /*String uuidValue = IdUtil.simpleUUID()+":"+Thread.currentThread().getId();
        System.out.println(uuidValue);

        System.out.println(System.currentTimeMillis());
        mytimeTask();*/

        System.out.println(notNull(null));
        System.out.println(notNull("bbb"));

    }

    public static String notNull(String param)
    {
        //return Optional.ofNullable(param)+"";
        //return Optional.ofNullable(param)+"";
        return Optional.ofNullable(param).orElse("aaa");
    }


    public static void mytimeTask()
    {
        new Timer().schedule(new TimerTask()
        {
            @Override
            public void run()
            {
                System.out.println(System.currentTimeMillis());
            }
        },3000);
    }
}